

// 切换菜单
$('.Baby_Healthy_home_billing_left_dl>dd').on("click",function(){
    if($(this).attr('flage')=='true'){
        $(this).addClass("bgc_alert").siblings().removeClass("bgc_alert");
        var ddIndex = $(this).index();
        if(ddIndex=="1"){
            $('.Baby_Healthy_home_billing_right_center').eq(1).removeClass('hidden').siblings(".Baby_Healthy_home_billing_right_center").addClass("hidden");
        }else if(ddIndex=="2"){
            if(baseFn.notNull(DocData.patientId)){
                $('.Baby_Healthy_home_billing_right_center').eq(2).removeClass('hidden').siblings(".Baby_Healthy_home_billing_right_center").addClass("hidden");
            }else{
                baseFn.infoDialog('请选择或添加一位患者')
            }
            
        }else if(ddIndex=="4"){
            if(baseFn.notNull(DocData.bookingId)){
                $('.Baby_Healthy_home_billing_right_center').eq(3).removeClass('hidden').siblings(".Baby_Healthy_home_billing_right_center").addClass("hidden");
            }else{
                baseFn.infoDialog('请将基础信息和病历信息填写完整')
            }
            
        }else if(ddIndex=="5"){
            if(baseFn.notNull(DocData.bookingId)){
                $('.Baby_Healthy_home_billing_right_center').eq(4).removeClass('hidden').siblings(".Baby_Healthy_home_billing_right_center").addClass("hidden");
            }else{
                baseFn.infoDialog('请将基础信息和病历信息填写完整')
            }
            
        }
    }
});


// 清空全部
$('.consumeListContains').on('click',".clearAll",function(){
    $('.Baby_Healthy_home_billing_left_dd').attr('flage',false).removeClass('bgc_alert');
    $(this).parents(".consumeListContains").addClass('hidden').siblings('.serachSelect').removeClass('hidden').siblings('.noticeImg').removeClass('hidden');
    $('.Baby_Healthy_home_billing_right_center').eq(0).removeClass('hidden').siblings(".Baby_Healthy_home_billing_right_center").addClass("hidden");
    $('.js_storeelm').find('.storeelm_checkbox').removeClass('checkBox_checked')
});

$('.consumeListContains').on('click','.saveBtnPay',function(){
    var d=baseFn.dialog({
        content:'确认保存该订单？',
        ok:function(){
            DocData.saveOrder()
        }
    })
})
$('.consumeListContains').on('click','.gatheringBtn',function(){
    if(DocData.orderId != ''){
        if(DocData.canPay){
            $.get(baseUrl.base+baseUrl.order+'selectOrderInfo',{orderId:DocData.orderId},function(res){
                if(res.code==0){
                    DocData.initOrder(res.results)
                    DocData.orderData = res.results
                    DocData.couponId = res.results.orderInfo.couponId
                    baseFn.dialog({
                        width:'40em',
                        height:'65vh',
                        title:'收银台',
                        content:$('.gatheringlist'),
                        okValue:'确认收款',
                        ok:function(){
                            var _upDatas={
                                orderId:DocData.orderId,
                                cashierId:DocData.cashierId,
                                payWay:DocData.payWay
                            }
                            $.post(baseUrl.base+baseUrl.order+'submitOrderInfo',_upDatas,function(res){
                                if(res.code ==0){
                                    baseFn.infoDialog('支付完成',function(){
                                        window.location.href=DocData.orderURL
                                    })
                                    
                                }else{
                                    baseFn.infoDialog(res.msg)
                                }
                            },'json')
                        }
                    })
                    DocData.canRenderOrderList()
                }
            },'json')
        }else{
            var d=baseFn.dialog({
                content:'订单有修改，是否保存后进行收款？',
                ok:function(){
                    DocData.saveOrder(true)
                },
                cancel:function(){}
            })
        } 
    }else{
        var d=baseFn.dialog({
            content:'订单未保存，是否保存后进行收款？',
            ok:function(){
                DocData.saveOrder(true)
            },
            cancel:function(){}
        })
    }
})
$('.payelm').on('click',function(){
    $(this).parents('.zccardelm').find('.payelm').removeClass('active')
    $(this).addClass('active')
    DocData.payWay=$(this).attr('rel')
})




